package com.fnic.wifi.threadLocal;

public class ThreadLocalDemoSingle implements Runnable {

	private int a = 0;

	public static void main(String[] agrs) {
		ThreadLocalDemoSingle td = new ThreadLocalDemoSingle();
		Thread t1 = new Thread(td, "t1");
		Thread t2 = new Thread(td, "t2");
		t1.start();
		t2.start();
	}

	/**
	 * 示例业务方法，用来测
	 */
	public void test() {
		while (true) {
			try {
				String currentThreadName = Thread.currentThread().getName();
				System.out.println("thread " + currentThreadName + " set age to:" + a++);
				Thread.sleep(1000);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}

	}

	@Override
	public void run() {
		test();
	}
}